
<p><b>syntax:</b> <i>ip_hash</i>
</p><p><b>default:</b> <i>none</i>
</p><p><b>context:</b> <i>upstream</i>
</p><p>This directive causes requests to be distributed between upstreams based on the IP-address of the client. <br />
The key for the hash is the class-C network address of the client.  This method guarantees that the client request will always be transferred to the same server. But if this server is considered inoperative, then the request of this client will be transferred to another server.  This gives a high probability clients will always connect to the same server.
</p><p>It is not possible to combine ip_hash and weight methods for connection distribution.  If one of the servers must be removed for some time, you must mark that server as *down*.
</p><p>For example:
</p><p></p>
<pre class="code"><span class="kw4">upstream</span> backend <span class="br0">&#123;</span>
  <span class="kw4">ip_hash</span>;
  <span class="kw3">server</span>   backend1.example.com;
  <span class="kw3">server</span>   backend2.example.com;
  <span class="kw3">server</span>   backend3.example.com  down;
  <span class="kw3">server</span>   backend4.example.com;
<span class="br0">&#125;</span></pre>
<br><i>Module: NginxHttpUpstreamModule</i>